package cn.wolfcode.crm.web.controller;

import cn.wolfcode.crm.domain.FailLog;
import cn.wolfcode.crm.query.FailLogQueryObject;
import cn.wolfcode.crm.service.IFailLogService;
import cn.wolfcode.crm.util.PageResult;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("fail")
public class FailLogController {

    @Autowired
    private IFailLogService failLogService;

    @RequestMapping("failLog")
    @RequiresPermissions(value = {"fail:failLog","开发失败记录页面"},logical = Logical.OR)
    public String failLog() throws Exception{
        return "fail/failLog";
    }
    @RequestMapping("lostLog")
    @RequiresPermissions(value = {"fail:failLog","客户流失记录页面"},logical = Logical.OR)
    public String lostLog() throws Exception{
        return "fail/lostLog";
    }

    @RequestMapping("selectAll")
    @ResponseBody
    public List<FailLog> selectAll() throws Exception{
        return failLogService.selectAll();
    }


    @RequestMapping("list")
    @ResponseBody
    public PageResult list(FailLogQueryObject qo) throws Exception{
        return failLogService.query(qo);
    }

}
